package net.yla.smartbus.module.controller.web.ba.area;

import net.yla.smartbus.core.api.ApiResult;
import net.yla.smartbus.core.base.BaseController;
import net.yla.smartbus.module.ba.area.form.PointsForm;
import net.yla.smartbus.module.ba.area.service.PointsService;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author 默苍离
 * @date 2021/7/5 10:57
 * <p>
 * ******************************************
 * @annotation:
 */
@RestController
@RequestMapping("/api/web/taxi/ba")
public class PointsController extends BaseController {

    private final PointsService pointsService;


    public PointsController(PointsService pointsService) {
        this.pointsService = pointsService;
    }

    /**
     * 保存坐标点
     *
     * @param pointsForm
     * @return
     */
    @PostMapping("points/save")
    public ApiResult save(@RequestBody PointsForm pointsForm) {
        if (pointsForm.getRegionId() != null) {
            Integer save = pointsService.save(pointsForm);
            return success(save);
        }
        return success(0);
    }

}
